Repository navigation
simplify converter - #544
Merged
Merged
Conversation
One schema-driven model of an MF6 block in both directions: stored DFNs and spec helpers, the rewritten loader (_Load), one egress path (_Unstructure), header kinds, and STO's period value as a word per period. Rebased onto develop be07090, with develop's changes ported into the rewritten paths: binary list input, array reading (modflowpy#513), external list writing (ListIO), binding rows (read_row/write_row), text tokens (modflowpy#534). The typed loader and its grammar work are dropped here, back to develop's; they're on typed-loader-parked, to go on a branch stacked on this one. _Load keeps its ComponentLoad base for that. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The report compares against a typed loader that isn't here, so it moves to typed-loader. Restore develop's load-benchmarks.md, which said that loader could be used. Co-Authored-By: Claude Opus 5.5 <[email protected]>
flopy4 mf6 sync writes them, so GitHub can collapse them in diffs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Plans live on dev-plans, not develop, so it shouldn't land with this. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sync formats its output only where ruff is on the PATH, and the test environments don't install it, so test_installed_dfns_match_classes failed there on formatting alone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The basic loader took a BEGIN inside a block as a row and any name after END, so a block missing its END swallowed the next one, with only a warning. It also ignored MAXBOUND's value, since MAXBOUND is computed. MF6 stops on both, so raise, naming the block and line or the entry. An unknown row or block still warns. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The loader's block structure came from DFNs stored with the classes and its values from the classes, joined by attr_names, which reran codegen's spec at load. The classes lacked only one fact to stand alone, which fields are untagged, and that's in the DFNs already. So codegen emits tagged=False, and spec.file_blocks and spec.block_keys route on attrs fields. Remove flopy4/mf6/dfns, _store_dfns, spec.dfn, attr_names and make._headers. test_mf6_routing.py holds generated classes to the DFNs they came from. unstructure_component's keys are now each field's name in the file (sfac), not the DFN's name for it (sfacrecord). Co-Authored-By: Claude Opus 5.5 <[email protected]>
… develop STO's value in these 37 is one word per period again. Against this branch before the rebase, they differ only by modflowpy#546's names. Co-Authored-By: Claude Opus 5.5 <[email protected]>
wpbonelli
force-pushed
the
simplify-converter
branch
from
November 6, 2026 01:18
5b81262 to
977be40
Compare
wpbonelli
added a commit
to wpbonelli/pyphoenix-project
that referenced
this pull request
Nov 6, 2026
factoring.md says where a constraint or format fact belongs: the DFN, the classes, the codec or a named check. It also says when the DFN should stop growing, and lists three structural changes that remove constraints. The converter plan records that modflowpy#544 no longer reads stored DFNs at runtime. Co-Authored-By: Claude Opus 5.5 <[email protected]>
wpbonelli
marked this pull request as ready for review
November 6, 2026 01:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IO architecture is currently like
where conversion means reshaping the data from the in-memory representation to one appropriate for serialization, i.e. turning instances of generated classes into builtin (or "de facto stdlib packages" e.g. numpy or pandas) collections and/or primitives at write time, vice versa on load.
previously this was pretty gross, with a lot of special casing and duplicative logic. make it all schema-driven, with the generated classes as the schema: codegen compiles the DFNs into class fields and metadata, and the converter reads those. one loop instead of seven, one array reader instead of three, one runtime schema instead of two
"simplify" here does not necessarily mean fewer LOC, sadly.
one API change sneaking in: GWF, CHF and OLF STO stress_period_data is now
{0: "steady-state"},Sto.StressPeriodDatais gone, flopy3steady_stateandtransientkwargs still workalso add two load validations that used to pass: a block missing its
END(aBEGINinside a block, or anENDnaming another block) and a badMAXBOUND(e.g.MAXBOUND two) now raiseValueErrorinstead of warning or loading silently, as MF6 stops on both